<template>
    <Form ref="formData" :model="formData" :rules="ruleValidate" :label-width="80">
        <FormItem label="标题" prop="title">
            <Input v-model="formData.title" ></Input>
        </FormItem>
        <FormItem label="内容" prop="content">
            <Input v-model="formData.content" ></Input>
        </FormItem>
        <FormItem label="是否顶置" prop="isTop">
            <Input v-model="formData.isTop" ></Input>
        </FormItem>
        <FormItem label="是否显示" prop="isDisplay">
            <Input v-model="formData.isDisplay" ></Input>
        </FormItem>
        <FormItem label="发帖人id" prop="posterId">
            <Input v-model="formData.posterId" ></Input>
        </FormItem>
        <div style="text-align: center;margin: 15px">
            <Button @click="handleReset('formData')">重置</Button>
            <Button type="primary" @click="handleSubmit('formData')" style="margin-left: 8px">保存</Button>
        </div>
        <!--加载中显示 -->
        <Spin size="large" fix v-if="spinShow"></Spin>
    </Form>
</template>

<script>
    import Base from '@/components/table/BaseEdit.vue';
    export default {
        extends:Base,
        data () {
            return {
                ruleValidate: {
                    title: [
                        { required: true, message: '请输入标题!', trigger: 'blur' },
                    ],
                    content: [
                        { required: true, message: '请输入内容!', trigger: 'blur' },
                    ],
                    isTop: [
                        { required: true, message: '请输入是否顶置!', trigger: 'blur' },
                    ],
                    isDisplay: [
                        { required: true, message: '请输入是否显示!', trigger: 'blur' },
                    ],
                    posterId: [
                        { required: true, message: '请输入发帖人id!', trigger: 'blur' },
                    ],
                }
            }
        },
        methods: {
            loadDataById(id){
                this.load("/api/post/read",{id})
            },handleSubmit (name) {
                //保存
                this.save(name,"/api/post/save");
            },
        }
    }
</script>

<style scoped>

</style>
